package com.example.demo.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.demo.entity.User;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

@Mapper
@Repository
public interface UserMapper extends BaseMapper<User> {

    @Select("select * from user where username = #{username} and password = #{password}")
    @Results({
            @Result(property = "id", column = "id"),
            @Result(property = "userRole", column = "id",
                    one = @One(select = "com.example.demo.mapper.UserRoleMapper.selectRoleByUserId"))
    })
    User selectUser(String username,String password);
}
